package state

import "fmt"

type State interface {
    Handle(ctx *Context)
}

type ConcreteStateA struct {
}
func (s *ConcreteStateA) Handle(ctx *Context) {
    fmt.Println("ConcreteStateA do something")
}

type ConcreteStateB struct {
}
func (s *ConcreteStateB) Handle(ctx *Context) {
    fmt.Println("ConcreteStateB do something")
}

type Context struct {
    state State
}
func (c *Context) SetState(state State) {
    c.state = state
}
func (c *Context) Request() {
    c.state.Handle(c)
}


